/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ontologia.session;

import com.ontologia.entities.Mediosdepropulsion;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Sebastian Rojas
 */
@Stateless
public class MediosdepropulsionFacade extends AbstractFacade<Mediosdepropulsion> {

  @PersistenceContext(unitName = "ontologia-ejbPU")
  private EntityManager em;

  @Override
  protected EntityManager getEntityManager() {
    return em;
  }

  public MediosdepropulsionFacade() {
    super(Mediosdepropulsion.class);
  }

  public void guardarMedioPropulsion(Mediosdepropulsion medio) {
    em.persist(medio);
  }

  public Mediosdepropulsion getMedioPropulsionDescripcion(String descripcion) {
    Mediosdepropulsion medioP = new Mediosdepropulsion();
    Query query = getEntityManager().createNamedQuery("Mediosdepropulsion.findByDescripcion");
    query.setParameter("descripcion", descripcion);
    medioP = (Mediosdepropulsion) query.getSingleResult();
    return medioP;
  }
}
